package cn.iocoder.yudao.module.member.level.dal.mysql;

import cn.iocoder.yudao.framework.business.basic.dao.mapper.CoreMapper;
import cn.iocoder.yudao.framework.business.basic.dao.query.CoreLambdaQueryWrapper;
import cn.iocoder.yudao.module.member.level.dal.dataobject.MemberLevelDO;
import cn.iocoder.yudao.module.member.level.vo.MemberLevelListReqVO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 用户等级 Mapper
 *
 * @author owen
 */
@Mapper
public interface MemberLevelMapper extends CoreMapper<MemberLevelDO> {

    default List<MemberLevelDO> selectList(MemberLevelListReqVO reqVO) {
        return selectList(new CoreLambdaQueryWrapper<MemberLevelDO>()
                .likeIfPresent(MemberLevelDO::getName, reqVO.getName())
                .eqIfPresent(MemberLevelDO::getStatus, reqVO.getStatus())
                .orderByAsc(MemberLevelDO::getLevel));
    }


    default List<MemberLevelDO> selectListByStatus(Integer status) {
        return selectList(new CoreLambdaQueryWrapper<MemberLevelDO>()
                .eq(MemberLevelDO::getStatus, status)
                .orderByAsc(MemberLevelDO::getLevel));
    }

}
